﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using EuroManager.Presentation.WebPortal.GameViewer.Data;
using EuroManager.Presentation.WebPortal.GameViewer.Models;

namespace EuroManager.Presentation.WebPortal.GameViewer.Updates
{
    public class ScoreUpdate : IGameUpdate
    {
        private Score score;
        private GameTeam team;
        private int value;

        public ScoreUpdate(Score score, GameTeam team, int value)
        {
            this.score = score;
            this.team = team;
            this.value = value;
        }

        public void Perform(float elapsedTime)
        {
            if (team == GameTeam.Team1)
            {
                score.Score1 = value;
            }
            else
            {
                score.Score2 = value;
            }
        }

        public void Revert(float elapsedTime)
        {
            if (team == GameTeam.Team1)
            {
                score.Score1 = value - 1;
            }
            else
            {
                score.Score2 = value - 1;
            }
        }
    }
}
